package com.java.exer_2;

public class Test1 {
    public static void main(String[] args) {
        //类： 自定义的类型
        //对象： 自定类型的变量

        int x = 10;
        double y = 3.14;

        //批量修改标识符： Alt + shift + R
//        Poker z = new Poker(2, 5);
//        System.out.print(z);

        Poker[] pokers = new Poker[52];
        //循环花色
        for (int i = 0; i < 4; i++) {
            for (int j = 1; j < 14; j++) {
                int index = i * 13 + j - 1;
                pokers[index] = new Poker(i, j);
                System.out.print(pokers[index] + "\t");
            }
            System.out.println();
        }
        //洗牌
        for (int i = 0; i < 36; i++) {
            // 0~51
            int posi1 = (int) (Math.random() * 52);
            int posi2 = (int) (Math.random() * 52);
            swap(pokers, posi1, posi2);
        }
        System.out.println("-------------------------------");
        int index = 0;
        for (Poker poker : pokers) {
            System.out.print(poker + "\t");
            if (++index % 13 == 0) {
                System.out.println();
            }
        }

    }

    private static void swap(Poker[] pokers, int posi1, int posi2) {
        Poker temp = pokers[posi1];
        pokers[posi1] = pokers[posi2];
        pokers[posi2] = temp;
    }
}
